<template>
    <div class="setting">
      <el-button :disabled="disabled" @click="buttonAble" type="primary" style="margin-left: 38px;height: 60px;">
  <i class="el-icon-setting" style="font-size: 20px;"></i>
</el-button>
        <!-- <i class="el-icon-setting" style="margin-right: 15px"></i>设置 -->
        <el-drawer
  title="关闭"
  :visible.sync="drawer"
  :direction="direction"
  :before-close="handleClose"
  size='20%'>
  <div style="position: absolute;left: 30%">
     <el-button type="primary" @click="logout">退出系统</el-button>
  </div>
</el-drawer>
    </div>
</template>
<script>
import { METHOD, request } from '@/utils/request'
import { Message } from 'element-ui'
export default {
  name: 'Setting',
  data () {
    return {
      drawer: false,
      disabled: false
    }
  },
  methods: {
    buttonAble () {
      this.drawer = true
      this.disabled = false
    },
    logout () {
      const params = ''
      request('/api/logout', METHOD.GET, params).then((resp) => {
        if (resp.status === 200) {
          Message({
            message: '退出成功!',
            type: 'success',
            duration: 5 * 1000
          })
          this.$router.push('/login')
          sessionStorage.removeItem('Authority1')
          sessionStorage.removeItem('Authority2')
          sessionStorage.removeItem('token')
        }
      })
    }
  }
}
</script>
<style scoped>
.setting{
  width: 60px;
}
.el-drawer{
  width: 50px;
}
</style>
